//
//  WeiBoModel.m
//  CloudWeibo
//
//  Created by CLOUD on 11/24/14.
//  Copyright (c) 2014 Cloud. All rights reserved.
//

#import "WeiBoModel.h"
#import "UserModel.h"

@implementation WeiBoModel

- (NSDictionary *) attributeMapDictionary
{
    NSDictionary *mapAtt = @{@"createDate":@"created_at",
                             @"weiBoId":@"id",
                             @"text":@"text",
                             @"source":@"source",
                             @"favorited":@"favorited",
                             @"thumbnailImage":@"thumbnail_pic",
                             @"bmiddleImage":@"bmiddle_pic",
                             @"originalImage":@"original_pic",
                             @"geo":@"geo",
                             @"repostsCount":@"reposts_count",
                             @"commentsCount":@"comments_count"
                             };
    return mapAtt;
}

- (void) setAttributes:(NSDictionary *)dataDic
{
    [super setAttributes:dataDic];
    
    NSDictionary *retweetDic = [dataDic objectForKey:@"retweeted_status"];
    if (retweetDic != nil) {
        WeiBoModel *relWeiBo = [[WeiBoModel alloc] initWithDataDic:retweetDic];
        self.relWeiBo = relWeiBo;
        [relWeiBo release];
    }
    
    
    NSDictionary *userDic = [dataDic objectForKey:@"user"];
    if (userDic != nil) {
        UserModel *user = [[UserModel alloc] initWithDataDic:userDic];
        self.user = user;
        [user release];
    }
    
    
    
}

@end
